/******************************************************************************
 **
 **    LISA Confidential
 **
 **    Source Materials
 **
 **    (C) COPYRIGHT LISA 2008-2009
 **
 **
 **  File Name:      TaskAssignmentHandler.java
 **  Description:    Assigns the task to the corresponding actor.
 **  Date:           2008-10-27
 **  Author:         LisaQian
 ******************************************************************************/
package com.ti.andon.workflow.assignment;

import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.taskmgmt.def.AssignmentHandler;
import org.jbpm.taskmgmt.exe.Assignable;

import com.ti.andon.workflow.WFConstants;

public class TaskAssignmentHandler  implements AssignmentHandler{
	/**
	 * Serial Version ID.
	 */
	private static final long serialVersionUID = 6128334020438717683L;

	/* (non-Javadoc)
	 * @see org.jbpm.taskmgmt.def.AssignmentHandler#assign(org.jbpm.taskmgmt.exe.Assignable, org.jbpm.graph.exe.ExecutionContext)
	 */
	public void assign(Assignable assignable, ExecutionContext executionContext) throws Exception
	{
		Long actorId = ((Long) executionContext.getContextInstance().getVariable(WFConstants.NEXT_REQUESTER));
		if (actorId != null)
		{
			assignable.setActorId(actorId.toString());
		}
	}
}
